
package sanger;

import com.amazonaws.auth.PropertiesCredentials;
import com.amazonaws.services.s3.AmazonS3Client;
import java.io.FileNotFoundException;
import java.io.IOException;


public class Constants {

    public static final String UPLOAD_DIR = "/root/aws/tmp"; //trailing '/' not required
    public static final String USER_FILE = "/root/aws/users.txt";
    public static final String BUCKET = "nib9-storage";
    public static final String AWS_DIR = "test/"; //trailing '/' required
    private static AmazonS3Client s3ref = null; //init on first use

    //Amazon singleton
    public static AmazonS3Client getS3Obj() throws FileNotFoundException, IOException {
        if (s3ref == null) {
            s3ref = new AmazonS3Client(new PropertiesCredentials(
                    Constants.class.getResourceAsStream("AwsCredentials.properties")));
            return s3ref;
        } else {
            return s3ref;
        }
    }
}
